use strict;
use warnings;
package Dictlino::Action::Query;
use base 'Dictlino::Action';

use Jifty::Param::Schema;
use Jifty::Action schema {
    param q => label is "Word";
    param
        d => label is "Dictionary",
        type is "Select",
        sticky_on_failure is 1,
        sticky_on_success is 1,
        available are qw(OKDaily Zdic TWMOE::Phrase);

};

use WWW::Dict;

sub take_action {
    my ($self) = @_;
    my $args   = $self->arguments;
    my $argv   = $self->argument_values;

    my $dict = WWW::Dict->new($argv->{d});
    my $def  = $dict->define($argv->{q});
    $self->result->content( definition => $def );
}

1;
